package com.gzdh.dishrecognition.config;

import android.content.Context;
import android.content.SharedPreferences;

import com.gzdh.dishrecognition.AppContext;
import com.gzdh.dishrecognition.emu.DeviceTypeEmus;

public class SystemConfig {
    private static SystemConfig systemConfig;

    public static SystemConfig getInstance() {
        if (systemConfig == null) {
            systemConfig = new SystemConfig();

        }
        return systemConfig;
    }

    private SharedPreferences sharedPreferences;

    private SharedPreferences.Editor editor;


    public SystemConfig() {
        sharedPreferences = AppContext.getInstance().getSharedPreferences("sysCost", Context.MODE_PRIVATE); //私有数据
        editor = sharedPreferences.edit();
        deviceType = DeviceTypeEmus.getByValue(sharedPreferences.getInt("type", 0));
    }

    private DeviceTypeEmus deviceType;

    private String templateId = "2021004104615091";

    private String abcpApplicationAppid = "2021004101630874";

    private String templateServiceCode = "BPaaSTemplateChannel";


    public String getTemplateServiceCode() {
        return templateServiceCode;
    }

    public void setTemplateServiceCode(String templateServiceCode) {
        this.templateServiceCode = templateServiceCode;
    }

    public String getTemplateId() {
        return templateId;
    }

    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }

    public String getAbcpApplicationAppid() {
        return abcpApplicationAppid;
    }

    public void setAbcpApplicationAppid(String abcpApplicationAppid) {
        this.abcpApplicationAppid = abcpApplicationAppid;
    }

    public DeviceTypeEmus getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(DeviceTypeEmus deviceType) {
        this.deviceType = deviceType;
        editor.putInt("type", deviceType.getValue());
        editor.apply();
    }
}
